package com.yonyou.gmcc.gateway.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.yonyou.gmcc.gateway.web.interceptor.AuthCheckInterceptor;

@Configuration
public class InterceptorConfigurer extends WebMvcConfigurerAdapter{

	@Bean
	public AuthCheckInterceptor wechatAuthCheckInterceptor(){
		return new AuthCheckInterceptor();
	}
	
//	/**
//    *
//    * @author LiuJun
//    * @date 2016年12月7日
//    * @param registry
//    * (non-Javadoc)
//    * @see org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter#addViewControllers(org.springframework.web.servlet.config.annotation.ViewControllerRegistry)
//    */
//    @Override
//    public void addViewControllers(ViewControllerRegistry registry) {
//        registry.addViewController("/views/askingPrice").setViewName("/views/askingPrice/askingPrice"); 
//    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 多个拦截器组成一个拦截器链
        // addPathPatterns 用于添加拦截规则
        // excludePathPatterns 用户排除拦截
		//InterceptorRegistration ir=registry.addInterceptor(this.wechatAuthCheckInterceptor());
		//ir.addPathPatterns("/web/manager/**");
		//ir.excludePathPatterns("/web/manager/login");
        //super.addInterceptors(registry);
    }
}
